# -*- coding: utf-8 -*-
import scrapy
from scrapy.selector import Selector
from doubanimg.items import DoubanimgItem

class DoubanimageSpider(scrapy.Spider):
    name = "doubanimage"
    allowed_domains = ["baidu.com"]
    start_urls = ['http://tieba.baidu.com/p/4909755294']

    def parse(self, response):
        sel = Selector(response)
        image_url = sel.xpath("//div[@id='post_content_101664928539']/img[@class='BDE_Image']/@src").extract()
        print image_url
        print '/n'
        item = DoubanimgItem()
        item['image_url'] = image_url
        yield item
